package com.lancoo.answer.ui.child.lookReview;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.lancoo.answer.R;
import com.lancoo.answer.model.AnswerConstant;
import com.lancoo.answer.model.ConstantBean;
import com.lancoo.answer.model.entity.wordSpell.WordListenWriteChild;
import com.lancoo.answer.view.adapter.wordSpell.WordSpellResultAdapter;

import java.util.List;

/**
 * Created by pengmi on 2022/1/20 14:48
 * Description:
 */
public class ChildWordListenWriteLookReviewFragment extends Fragment {

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.ev_fragment_child_word_spell_look_review, container, false);
    }

    public static Fragment loadChildFragment(int kindIndex, int queseIndex, int smallQueseIndex){
        ChildWordListenWriteLookReviewFragment queseFragment=new ChildWordListenWriteLookReviewFragment();
        Bundle mBundle=new Bundle();
        mBundle.putInt(AnswerConstant.KEY_TYPEINDEX,kindIndex);
        mBundle.putInt(AnswerConstant.KEY_QUESINDEX,queseIndex);
        mBundle.putInt(AnswerConstant.KEY_CHILDINDEX,smallQueseIndex);
        queseFragment.setArguments(mBundle);
        return queseFragment;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        initView(view);
    }

    private void initView(View view){
        RecyclerView mRecyclerView=view.findViewById(R.id.mRecyclerView);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        List<WordListenWriteChild> wordListenSpellList = ConstantBean.Companion.getWordListenSpellList();
        WordSpellResultAdapter mAdapter=new WordSpellResultAdapter(wordListenSpellList);
        mRecyclerView.setAdapter(mAdapter);
    }
}
